package com.mall.product.controller;

import com.mall.entity.TbCar;
import com.mall.product.service.CarService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 购物车控制器
 *
 * @author S
 * @date 2021/07/18
 */
@RestController
@RequestMapping("/car")
@CrossOrigin
public class CarController {

    @Autowired
    private CarService carService;

    /**
     * 前端接口，获取需要秒杀的商品信息
     *
     * @return {@link List<TbCar>}
     */
    @RequestMapping("/findSeckillCar")
    public List<TbCar> findSeckillCar(){
        return carService.findSeckillCar();
    }

    /**
     *     查询购物车类型为秒杀的信息
     */
    @GetMapping("/findCarByStatus")
    public List<TbCar> findCarByStatus(){
        return carService.findCarByStatus();
    }

}
